package com.usian.article.controller;

import com.usian.apis.article.ApArticleControllerApi;
import com.usian.article.service.ApArticleConfigService;
import com.usian.article.service.ApArticleService;
import com.usian.model.article.pojos.ApArticle;
import com.usian.model.article.pojos.ApArticleConfig;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.common.enums.AppHttpCodeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/article")
public class ApArticleController implements ApArticleControllerApi {

    @Autowired
    private ApArticleService articleService;

    @Autowired
    private ApArticleConfigService apArticleConfigService;

    @Override
    @PostMapping("/save")/*保存ap端文章*/
    public ApArticle saveArticle(@RequestBody ApArticle apArticle) {
         articleService.save(apArticle);
         return apArticle;
    }

    @Override
    @GetMapping("/findArticleById/{id}")/*根据id查询app端文章*/
    public ApArticle findArticleById(@PathVariable Long id) {
        return articleService.getById(id);
    }


}
